package com.test;

import java.util.Timer;
import java.util.TimerTask;

public class Tugas extends TimerTask {
    private String name;
    public Tugas(String name) {
        this.name = name;
    }
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(i + " " + name);
        }
    }
}
class TimerExample {
    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new Tugas("Bali"), 1000);
        Timer timer1 = new Timer();
        timer1.schedule(new Tugas("Jogja"), 0, 1000);
    }
}